package BluetoothFileMgr.start;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import android.bluetooth.BluetoothSocket;

public class WriteThread implements Runnable{
	
	    private BluetoothSocket mmSocket;
	    private String s = null;
	 
	    public WriteThread(String s)
	    {
	        mmSocket = DeviceConnect.mmSocket;
	        this.s = s;
	    }
	 
	    public void run()
	    {
	    	DataOutputStream dout = null;
	    	
	    	OutputStream out = null;
			try {
				if(BluetoothFileMgrActivity.mode.equals("Bluetooth"))
				{
					dout = new DataOutputStream(DeviceConnect.mmSocket.getOutputStream());
				}
				else
				{
					dout = new DataOutputStream(DeviceConnect.wifiSocket.getOutputStream());
				}
				dout.writeUTF(s);
				//out = mmSocket.getOutputStream();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            //PrintWriter pr = new PrintWriter(out);
            //pr.println(s);
			byte[] b = s.getBytes();
			try {
				//out.write(b);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			
        }
	}